package com.sqk.dxpro.dxmatch;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;


public class DxMatchMain {

	public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
//		conf
		System.setProperty("hadoop.home.dir", "F:\\Configuration\\hadoop-2.6.0");
		Configuration conf=new Configuration();
		//job
		Job job=Job.getInstance(conf);
		//set(jar,mapper,reducer)
		job.setJarByClass(DxMatchMain.class);
		job.setMapperClass(DxMatchMapper.class);
		job.setNumReduceTasks(0);
		
		
		job.setOutputKeyClass(NullWritable.class);
		job.setOutputValueClass(Text.class);

		job.addCacheFile(new Path("F:\\SparkTask\\data\\t_dx_basic_msg_addr.txt").toUri());
		
		FileInputFormat.setInputPaths(job, new Path("F:\\SparkTask\\DxClear"));
		FileOutputFormat.setOutputPath(job, new Path("F:\\SparkTask\\DxMatch"));
		// 提交作业 判断退出条件（0正常退出，1非正常退出）
		System.exit(job.waitForCompletion(true) ? 0 : 1);
		
	}

}
